﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using Chain.DBUtility;
using System.Web.UI.HtmlControls;

public partial class Mobile_mySonCard : System.Web.UI.Page
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie wxMem = base.Request.Cookies["uid"];
        if (wxMem != null)
        {
            Chain.BLL.Mem BllMem = new Chain.BLL.Mem();
            StringBuilder builder = new StringBuilder();
            builder.Append("select memid,MemName,MemMoney,MemCard,isnull(MemMobile,'') MemMobile,case when boll1=0 and boll2=0 then 0 else 1 end  boll from(");
            builder.Append("select memid,MemName,MemMoney,MemCard,isnull(MicroOrderMemID,0) as boll1,isnull(MemMobile,'') MemMobile,isnull(ordermemid,0) as boll2,MemRecommendID from mem left join ");
            builder.Append("( select MicroOrderMemID FROM MicroWebsiteOrderLog ");
            builder.Append(" group by MicroOrderMemID )a  ");
            builder.Append(" on MemID=MicroOrderMemID  ");
            builder.Append(" left join  ");
            builder.Append(" (select ordermemid from OrderLog group by ordermemid )b  ");
            builder.Append(" on MemID=ordermemid)a  ");
            builder.Append(" where MemRecommendID=" + wxMem.Value);
            DataSet ds = DbHelperSQL.Query(builder.ToString());
            if (ds.Tables[0].Rows.Count<=0)
            {
                 this.msg.Style.Add("display", "");
                 return;
            }
            this.rptShopList.DataSource = ds.Tables[0];
            this.rptShopList.DataBind();
        }
        else
        {
            base.Response.Redirect("login.aspx");
        }
    }
}